"""
使用函数求余弦函数的近似值
"""
import math
def funcos(eps, x):
    p = 2
    n = 1
    c = 1
    cos = 1
    while True:
        n *= -p*(p-1)
        c = math.pow(x, p)/n
        p += 2
        if abs(c) < eps: break
        cos += c
    return cos






eps=float(input())
x=float(input())
value=funcos(eps,x )
print("cos({0}) = {1:.4f}".format(x,value))